package app.project.streetlensproject.util;

import com.google.android.gms.maps.model.LatLng;

import android.content.Context;
import android.content.res.Configuration;
import app.project.streetlensproject.R;
import app.project.streetlensproject.fragment.FgCategory;
import app.project.streetlensproject.model.Category;

public class Constants {

	public static final int TYPE_INFO=0;
	public static final int TYPE_ADDRESS=1;
	public static final int TYPE_MOBILE=2;
	public static final int TYPE_MOBILE_PHONE=3;
	public static final int TYPE_FAX=4;
	public static final int TYPE_VIDEO=5;
	public static final int TYPE_WEBSITE=6;
	public static final int TYPE_EMAIL=7;
	
	public static final int LANGUAGE_VN=0;
	public static final int LANGUAGE_EN=1;
	
	public static final String BROWSER_KEY="AIzaSyCO_V8Jh6UvxnFwKfvw1n1KF6GADrUyZ0g";
	public static final String ANDROID_KEY="";

	public static final String MODE_DRIVING = "d";
	public static final String MODE_WALKING = "w";
	public static final String MODE_CYCLING = "r";

	public static final int RESULT_LOAD_IMAGE = 1;

	public static final int ID_C_ALL = 0;
	public static final int ID_C_OTHER = 1;
	public static final int ID_C_FOOD = 2;
	public static final int ID_C_SHOP = 3;
	public static final int ID_C_BANK = 4;
	public static final int ID_C_KHAN_CAP = 5;
	public static final int ID_C_FUEL = 6;
	public static final int ID_C_GIAI_TRI = 7;
	public static final int ID_C_HOTEL = 8;
	public static final int ID_C_BUS = 9;
	public static final int ID_C_SCHOOL = 10;
	public static final String EMAIL = "EMAIL";
	public static final String TOKEN_ID = "public";
	public static final String USER_NAME = "USER_NAME";

	public static final LatLng MYPLACE_DEFAULT = new LatLng(21.032897, 105.787436);
	public static final String RADIUS = "RADIUS";
	public static final String IS_DISPLAY_ALL = "IS_DISPLAY_ALL";

	public static final int FROM_LISTPLACE = 0;
	public static final int FROM_CATEGORY = 1;
	public static final String IS_EN = "IS_EN";

	public static String getNameCate(Context context, int cateID) {
		if (cateID == 0)
			return context.getString(R.string.all);
		Configuration loc = new Configuration(context.getResources().getConfiguration());
		String code = loc.locale.getLanguage();
		if (FgCategory.items != null) {
			for (Category c : FgCategory.items) {
				if (c.categoryId == cateID) {
					int start = c.name.indexOf('*');
					String vi = c.name.substring(0, start);
					String en = c.name.substring(start + 1, c.name.length());
					if (code.equals("vi"))
						return vi;
					else
						return en;
				}
			}
		}
		return "";
	}

	public static int getDrawableID(int cateID) {
		switch (cateID) {
		case ID_C_ALL:
			return R.drawable.ic_all;
		case ID_C_OTHER:
			return R.drawable.ic_other;
		case ID_C_FOOD:
			return R.drawable.ic_food;
		case ID_C_SHOP:
			return R.drawable.ic_shoping;
		case ID_C_BANK:
			return R.drawable.ic_bank;
		case ID_C_KHAN_CAP:
			return R.drawable.ic_emergency;
		case ID_C_FUEL:
			return R.drawable.ic_fuel;
		case ID_C_HOTEL:
			return R.drawable.ic_hotel;
		case ID_C_BUS:
			return R.drawable.ic_bus;
		case ID_C_SCHOOL:
			return R.drawable.ic_school;
		case ID_C_GIAI_TRI:
			return R.drawable.ic_entertaiment;
		default:
			return -1;
		}
	}
}
